<?php

namespace App\Models;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;

class User extends Authenticatable    # 这里别忘了加
{
    use HasApiTokens, HasFactory, Notifiable;



    protected $table = 'user-msg';     // 1.用户模型关联表
    protected $primaryKey = 'id';        //2. 关联表的主键

    protected $fillable = [              // 3.允许被批量操作的字段, 相当于python的一个Meta中的序列器
        'username',
        'password',
        'sex',
        'address',
        'registerTime',
        'updateTime',
        'deleteTime',
        'isDelete',
    ];
    public $timestamps = false;         // 4.禁用时间戳, 是否维护created_at和updated_at字段

    /**
     * The attributes that should be hidden for serialization.
     *
     * @var array
     */
    protected $hidden = [
        'password',
    ];

    /**
     * The attributes that should be cast.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];


//    user-msg表用于存放数据
    public function getJWTIdentifier()
    {
        return $this->getKey();
    }
    public function getJWTCustomClaims()
    {
        return [];
    }




}
